package com.bupt.uchouten.common.register;

import com.google.common.collect.Maps;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
import net.minecraftforge.registries.ForgeRegistries;

import java.util.Map;
import java.util.function.Supplier;

import static com.bupt.uchouten.common.util.Reference.MODID;

public final class UchoutenBiomeKeys {
	// 玄云海
	public static final BiomeKey mysteriousSeaOfClouds = new BiomeKey("mysterious_sea_of_clouds", true, 0.0F);
	// 有顶天
	public static final BiomeKey uchouten = new BiomeKey("uchouten", true, 0.0F);

	public record BiomeKey(ResourceKey<Biome> key, boolean generate, float suppress) {
		static final Map<ResourceKey<Biome>, BiomeKey> ALL_BIOME_KEYS = Maps.newHashMap();

		public BiomeKey(ResourceKey<Biome> key, boolean generate, float suppress) {
			this.key = key;
			this.generate = generate;
			this.suppress = suppress;

			ALL_BIOME_KEYS.put(key, this);
		}

		public BiomeKey(String name, Supplier<Boolean> generate, Supplier<Float> suppress) {
			this(name, generate.get(), suppress.get());
		}

		public BiomeKey(String name, boolean generate, float suppress) {
			this(ResourceKey.create(ForgeRegistries.Keys.BIOMES, new ResourceLocation(MODID, name)), generate, suppress);
		}
	}

	private UchoutenBiomeKeys() {
	}
}
